package com.disapand.mall.exception;

import com.disapand.mall.util.FormatResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author disapand
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    @ResponseBody
    @ExceptionHandler(CustomException.class)
    public FormatResponse nullResultException(CustomException customException) {
        return FormatResponse.of(customException.getCode(), customException.getMessage(), null);
    }
}
